package me.buick.util.jmeter.snmpprocess.snmpmgmt;

import java.util.Map;

import me.buick.util.snmp.core.pojo.ProcessInfoPojo;

import org.apache.jmeter.samplers.SampleResult;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;

/**
 * 
 * Version 1.0
 * 
 * @author buick
 *
 */

public class SNMPProcessSampleResult extends SampleResult {
	
	private static final long serialVersionUID = -1555976628502183631L;

	static final Logger log = LoggingManager.getLoggerForClass();
	
	private transient SNMPProcessSampleResult preSampleResult;
	private transient SNMPProcessSampleResultProcessor processor;
	
	private long     timeStamp;
	private String   server;
	private String   port;
	private String   serverType;
	private String   snmpSuiteID;
	private String   procDescr;
	private double   totalCPUPerc;
	private long     totalMemUsage;
	private double   totalMemUsagePerc;
	private String   snmpDataRetriveInterval;

	private Map<Integer, ProcessInfoPojo> processPojoMap;

	public SNMPProcessSampleResult(SNMPProcessSampleResultProcessor processor){
		this.processor = processor;
	}
	
	public String getProcDescr() {
		return procDescr;
	}

	public void setProcDescr(String procDescr) {
		this.procDescr = procDescr;
	}

	public Map<Integer, ProcessInfoPojo> getProcessPojoMap() {
		return processPojoMap;
	}

	public void setProcessPojoMap(Map<Integer, ProcessInfoPojo> processPojoMap) {
		this.processPojoMap = processPojoMap;
	}
	
	public String getServer() {
		return server;
	}

	public void setServer(String server) {
		this.server = server;
	}

	public String getPort() {
		return port;
	}

	public void setPort(String port) {
		this.port = port;
	}

	public String getServerType() {
		return serverType;
	}

	public void setServerType(String serverType) {
		this.serverType = serverType;
	}

	public SNMPProcessSampleResult getPreSampleResult() {
		return preSampleResult;
	}

	public void setPreSampleResult(SNMPProcessSampleResult preSampleResult) {
		this.preSampleResult = preSampleResult;
	}

	public long getTimeStamp() {
		return timeStamp;
	}

	public void setTimeStamp(long timeStamp) {
		this.timeStamp = timeStamp;
	}

	public String getSnmpSuiteID() {
		return snmpSuiteID;
	}

	public void setSnmpSuiteID(String snmpSuiteID) {
		this.snmpSuiteID = snmpSuiteID;
	}

	public SNMPProcessSampleResultProcessor getProcessor() {
		return processor;
	}

	public void setProcessor(SNMPProcessSampleResultProcessor processor) {
		this.processor = processor;
	}
	
	public SNMPProcessSampleResult processSampleResult() throws Exception{
		if(this.processor != null){
			this.processor.readSampleResult(this);
			return this;
		}else{
			log.error("SNMP Result Processor Not Found");
			return null;
		}
	}

	public double getTotalCPUPerc() {
		return totalCPUPerc;
	}

	public void setTotalCPUPerc(double totalCPUPerc) {
		this.totalCPUPerc = totalCPUPerc;
	}

	public long getTotalMemUsage() {
		return totalMemUsage;
	}

	public void setTotalMemUsage(long totalMemUsage) {
		this.totalMemUsage = totalMemUsage;
	}

	public double getTotalMemUsagePerc() {
		return totalMemUsagePerc;
	}

	public void setTotalMemUsagePerc(double totalMemUsagePerc) {
		this.totalMemUsagePerc = totalMemUsagePerc;
	}
	
	public String getSnmpDataRetriveInterval() {
		return snmpDataRetriveInterval;
	}

	public void setSnmpDataRetriveInterval(String snmpDataRetriveInterval) {
		this.snmpDataRetriveInterval = snmpDataRetriveInterval;
	}
	
}
